package com.naiterui.ehp.bs.emr.controller.inner;

import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bp.support.exception.PublicService;
import com.naiterui.ehp.bp.support.exception.ResponseVO;
import com.naiterui.ehp.bs.emr.service.IPatientHealthRecordService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description 家庭档案
 * @Author gongbaoqiang
 * @Date 2020/6/3 6:12 PM
 */
@Slf4j
@Api(tags = SwaggerTag.INNER_API + SwaggerTag.MEDICAL_RECORD)
@RestController
@RequestMapping("emr/inner/patient/health/record")
public class EmrInnerPatientHealthRecordController {

    @Autowired
    private IPatientHealthRecordService healthRecordService;
    /**
     * 获取患者已经提交档案的家庭成员
     * @param patientId
     * @return
     * @throws BusinessException
     */
    @GetMapping("familys")
    public ResponseVO<List<Long>> cache(Long patientId) throws BusinessException {
        log.info("获取患者家庭成员档案信息：patientId={}", patientId);
        return PublicService.returnResponseVO(healthRecordService.findFamilyIdsByPatient(patientId));
    }

}
